import React from 'react';
import { Route, Redirect, withRouter } from 'react-router-dom';

import Home from 'modules/home';
import EoxHome from 'modules/eox/home';
import EoxProfessions from 'modules/eox/professions';
import EoxProfessionsDetail from 'modules/eox/professions-detail';
import EoxMaze from 'modules/eox/maze';
import WrapAnimation from 'components/wrap-animation';

/** 首页 */
const WrapHome = WrapAnimation(Home);
/** 世界树迷宫X */
const WrapEoxHome = WrapAnimation(EoxHome);
const WrapEoxProfessions = WrapAnimation(EoxProfessions);
const WrapEoxProfessionsDetail = WrapAnimation(EoxProfessionsDetail);
const WrapEoxMaze = WrapAnimation(EoxMaze);

const Routes = withRouter(({ location, history }) => (
  <>
    <Route exact path="/home">{(props) => <WrapHome {...props} />}</Route>
    <Route exact path="/eox/home">{(props) => <WrapEoxHome {...props} />}</Route>
    <Route exact path="/eox/professions">{(props) => <WrapEoxProfessions {...props} />}</Route>
    <Route exact path="/eox/professions/:profession">{(props) => <WrapEoxProfessionsDetail {...props} />}</Route>
    <Route exact path="/eox/maze">{(props) => <WrapEoxMaze {...props} />}</Route>
    <Route exact path="/eox/maze/:maze">{(props) => <WrapEoxMaze {...props} />}</Route>
    <Redirect from="/" to="/home" />
  </>
));
export default Routes;
